#pragma once
#include "State.h"
#include "Portfolio.h"

class ModuleState :
	public State
{

public:
	ModuleState(string name) :name(name)
	{
		mouseoldz = mouseover = quit = lock = state = collided = 0;
		buttonroll = mouselock = mousecounter = 0;
		scroll_position = 0;
		exenum = 0;

		line = 0;

		mousehit_pmask = NULL; 
		submenubutton_pmask = NULL;
		B_mousehit = NULL;
	}
	~ModuleState(void);

protected:

	void triforce(const int x, const int y, const int color, const int distance = 10);

	void showInstructions();

	void checkMouse();

	void drawButtons(unsigned int buttons = 7);

	void moduleTextHelp(int textnum)
	{
		int msgIdx = 0;
		switch(textnum)
		{
		case 1:
			msgIdx = 6;
			break;
		case 2:
			msgIdx = 5;
			break;
		case 3:
			msgIdx = 7;
			break;
		default:
			break;
		}
		port->getGUtil()->drawTextToBackBuffer(
			port->getRMgr()->font,
			defaultmsg[msgIdx],
			512,532,
			C_MainFolderShadow);
		port->getGUtil()->drawTextToBackBuffer(
			port->getRMgr()->font,
			defaultmsg[msgIdx],
			510,530,
			C_MainFolder);
	}

protected:
	string name;

	int mouseoldz, mouseover;
	int quit;
	int lock;
	int state;
	int collided;
	int buttonroll;

	//Mouse checks
	int mouselock;
	int mousecounter;

	//For the textscroller
	int scroll_position;

	//number of exe files
	int exenum;

	char helpText[256][256];
	char exename[64][64];
	char exedesc[256][256];

	// Collision detection images
	PMASK *mousehit_pmask;
	PMASK *submenubutton_pmask;
	BITMAP *B_mousehit;

	string helpFileName;
	string dataFileName;
	string exeFileName;

	int line;
};
